Migration
|
This is the section to use migration function of Xen. It's easy to make GuestOS migrate to another computer with this function.
At least 2 computers are needed if you use this function. (But It's the best if you use 3 computers if possible) Anyway, I can't use 3 computers, so I did migration with 2 computers on here. First, Create the same environment with primary computer in second computer and mount a directory with NFS that image-file of GuestOS is located in primary computer. |
|
[1] | Configure on primary computer |
[root@ns ~]# vi /etc/exports /home 192.168.0.0/24(rw,sync,no_root_squash) # add /var/xen 192.168.0.0/24(rw,sync,no_root_squash) [root@ns ~]# /etc/rc.d/init.d/nfs restart Shutting down NFS mountd: [ OK ] Shutting down NFS daemon: [ OK ] Shutting down NFS quotas: [ OK ] Shutting down NFS services: [ OK ] Starting nfs services: [ OK ] Starting nfs quotas: [ OK ] Starting nfs daemon: [ OK ] Starting nfs mountd: [ OK ] [root@ns ~]# vi /etc/xen/xend-config.sxp # line 21: make valid and change to 'yes' (xend-relocation-server yes )# line 33: uncomment (xend-relocation-port 8002) # line 58: uncomment (xend-relocation-hosts-allow '') # line 59: make it comment # (xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')[root@ns ~]# /etc/rc.d/init.d/xend restart restart xend: [ OK ]
|
[2] | Configure on secondary computer |
[root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host2 0
510
2
r-----
12.6 [root@ns ~]# mkdir /var/xen [root@ns ~]# mount -t nfs 192.168.0.17:/var/xen /var/xen [root@ns ~]# vi /etc/xen/xend-config.sxp # line 21: uncomment and change to 'yes' (xend-relocation-server yes )# line 33: uncomment (xend-relocation-port 8002) # line 58: uncomment (xend-relocation-hosts-allow '') # line 59: uncomment # (xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')[root@ns ~]# /etc/rc.d/init.d/xend restart restart xend: [ OK ]
|
[3] | Move to Primary computer and Execute migration of GuestOS 'rx7' |
[root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host 0
510
2
r-----
34.6 lan 3
511
2
r-----
10.8 rx7 4
511
2
r-----
13.9 2
511
2
r-----
19.4 www 1
511
2
r-----
12.3 [root@ns ~]# xm migrate rx7 192.168.0.105 # migration [root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host 0
510
2
r-----
34.6 lan 3
511
2
r-----
10.8 2
511
2
r-----
19.4 www 1
511
2
r-----
12.3 # rx7 has just gone like above
|
[4] | Make sure whether 'rx7' has come or not on secondary computer. |
[root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host2 0
510
2
r-----
34.6 rx7 2
511
2
r-----
0.1 # Wellcome!
|
Migration has been success, however, following errors are displayed. Well, it's not good because CPUs on 2 computers are different. It seems we must use the same CPU on primary and secondary computers if we use migration function. |
BUG: soft lockup detected on CPU#1! [<c043ea7f>] softlockup_tick+0x98/0xa6 [<c0408b7d>] timer_interrupt+0x504/0x557 [<c043ecb3>] handle_IRQ_event+0x27/0x51 [<c043ed70>] __do_IRQ+0x93/0xe8 [<c040672b>] do_IRQ+0x93/0xae [<c053a095>] evtchn_do_upcall+0x64/0x9b [<c0404ec5>] hypervisor_callback+0x3d/0x48 [<c0407fd1>] raw_safe_halt+0x8c/0xaf [<c0402bca>] xen_idle+0x22/0x2e [<c0402ce9>] cpu_idle+0x91/0xab ======================= [root@ns ~]# xm migrate rx7 192.168.0.17 [root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host2 0
510
2
r-----
36.3 |
[5] | If you don't want to kill network connection at all, use Live-Migration. It's easy to use it. Execute the command 'xm migrate --live'. |
//////////// Primary Computer //////////// [root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host 0
510
2
r-----
34.6 lan 3
511
2
r-----
10.8 rx7 4
511
2
r-----
13.9 2
511
2
r-----
19.4 www 1
511
2
r-----
12.3 [root@ns ~]# xm migrate --live rx7 192.168.0.105 [root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host 0
510
2
r-----
34.6 lan 3
511
2
r-----
10.8 2
511
2
r-----
19.4 www 1
511
2
r-----
12.3 //////////// Secondary Computer //////////// [root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host2 0
510
2
r-----
34.6 rx7 2
511
2
r-----
0.1 [root@ns ~]# xm migrate --live rx7 192.168.0.17 [root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host2 0
510
2
r-----
51.6 //////////// Primary Computer //////////// [root@ns ~]# xm list Name ID Mem(MiB) VCPUs State Time(s) Host 0
510
2
r-----
34.6 lan 3
511
2
r-----
10.8 rx7 4
511
2
r-----
13.9 2
511
2
r-----
19.4 www 1
511
2
r-----
12.3 |